package com.chenlonghai.sbmybatis.entity;

import java.text.SimpleDateFormat;
import java.util.Map;

public class ResultModel<T> {
    
	private String code;
	private String mesg;
	private T  result;
	private Map<String, Object> resultMap;

	public String getMesg() {
		return mesg;
	}
	public void setMesg(String mesg) {
		this.mesg = mesg;
	}
	public T getResult() {
		return result;
	}
	public void setResult(T result) {
		this.result = result;
	}
	public ResultModel(T result,Map<String, Object> resultMap) {
		super();
		if (result == null) {
			this.code = "0";
			this.mesg = "失败";
		}else{
			this.code = "1";
			this.mesg = "成功";
		}
		this.result = result;
		this.resultMap = resultMap;
		this.resultMap.put("result", this.result);
		this.resultMap.put("code", this.code);
		this.resultMap.put("mesg", this.mesg);
	} 
	
	public Map<String, Object> getResltMap(){
		return  this.resultMap;
	}
    public static String dateToStrLong(java.util.Date dateDate) {
		  SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		  String dateString = formatter.format(dateDate);
		   return dateString;
	 }
	
}
